package com.bw.a2207a.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.bw.a2207a.base.BaseBean
import com.bw.a2207a.base.BaseViewModel
import com.bw.a2207a.bean.BannerBean
import com.bw.a2207a.bean.LoginBean
import com.bw.a2207a.bean.TypeBean
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.buffer
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

/**
 *
 * @ClassName: LoginViewModel
 * @Description: java类作用描述
 * @Author: zhangyanchao
 * @CreateDate: 2024/10/17 11:28 AM
 * @Version: 1.0
 */
class TypeViewModel : BaseViewModel() {


    val typeLiveData = MutableLiveData<BaseBean<List<TypeBean>>>()


    fun getType() {
        viewModelScope.launch {
            withContext(Dispatchers.IO) {
                typeLiveData.postValue(apiService.getType())
            }
        }
    }
}